/**
 * 
 */
package com.jdy.haoduoaiteacher.fragment;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;

import com.jdy.haoduoaiteacher.adapter.RecommendGridAdapter;
import com.jdy.haoduoaiteacher.intface.OnRecommendItemClickListener;
import com.jdy.haoduoaiteacher.model.AlbumItem;
import com.ycsj.goldmedalnewconcept.R;

import java.util.List;

//import com.jdy.haoduoaiteacher.R;

/**
 * @author zp 2016-12-21 下午3:03:22
 */
public class GridViewFragment extends BaseFragment {

  private List<AlbumItem> mAIList;

  private OnRecommendItemClickListener mOnRecommendItemClickListener;

  public GridViewFragment() {
  }

  @SuppressLint("ValidFragment")
  public GridViewFragment(List<AlbumItem> ais,
                          OnRecommendItemClickListener listener) {
    this();
    mAIList = ais;
    mOnRecommendItemClickListener = listener;

  }

  @Override
  public View onCreateView(Bundle savedInstanceState, LayoutInflater inflater,
      ViewGroup container) {
    View bodyView = LayoutInflater.from(mContext).inflate(
        R.layout.gridview_4_columns, container, false);

    GridView gv = (GridView) bodyView.findViewById(R.id.recommend_gv);

    RecommendGridAdapter rga = new RecommendGridAdapter(getActivity(), mAIList);

    rga.setOnRecommendItemClickListener(mOnRecommendItemClickListener);

    gv.setAdapter(rga);

    return bodyView;
  }
}
